@file:JvmName("ResponseUtil")

package com.tt.vertx.router

import com.tt.vertx.bean.Entity
import com.tt.vertx.service.html
import com.tt.vertx.service.json
import com.tt.vertx.service.test
import io.vertx.core.Vertx
import io.vertx.core.json.Json
import io.vertx.ext.web.Router

fun customRouter(v: Vertx): Router {
    val router = Router.router(v)
    router.get("/hello").handler({ c -> c.response().html().end("hello world") })
    router.post("/json").handler({ c -> c.response().json().end(Json.encode(Entity("name", "sssat"))) })
    router.get("/test").handler({ c -> test(c) })
    return router
}
